<?php

declare( strict_types = 1 );

namespace App\Common\Model\Base\DataUnit;

use App\Common as com;
use App\Common\Model as nameModel;
use App\Common\Model\Base\DataUnit as nameDataUnit;

class DataTreating extends nameDataUnit\Base {

	/**
	 * @var array
	 */
	private array $dataTreatingPool = [];

	/**
	 * 加入处理池
	 * @param string $funName
	 * @param array $param
	 * @return $this
	 */
	protected function addTreatingPool( string $funName, array $param = [] ):self {
		if( ! array_key_exists( $funName, $this->dataTreatingPool ) ){
			$this->dataTreatingPool[ $funName ] = $param;
		}
		//
		return $this;
	}

	/**
	 * 执行处理池
	 * @param $dataQuote
	 * @return $this
	 */
	public function execTreatingPool( &$dataQuote ):self {
		foreach( $this->dataTreatingPool as $dataTreatingPoolKey => $dataTreatingPoolValue ){
			call_user_func_array( [ $this, "_{$dataTreatingPoolKey}" ], [ &$dataQuote, $dataTreatingPoolValue ] );
		}
		//
		return $this;
	}
	
}
